﻿namespace CMS.REST
{
    /// <summary>
    /// REST权限控制块
    /// </summary>
    public struct RESTPermission
    {
        /// <summary>
        /// 查找权限
        /// </summary>
        public int Index { get; set; }

        /// <summary>
        /// 读取单个数据
        /// </summary>
        public int Read { get; set; }

        /// <summary>
        /// 保存一个或多个数据
        /// </summary>
        public int Save { get; set; }

        /// <summary>
        /// 更新一个或多个数据
        /// </summary>
        public int Update { get; set; }

        /// <summary>
        /// 删除多个数据
        /// </summary>
        public int Delete { get; set; }

        /// <summary>
        /// 保存列表
        /// </summary>
        public int SaveList { get; set; }

        /// <summary>
        /// 初始化一个默认权限
        /// </summary>
        /// <param name="query"></param>
        /// <param name="save"></param>
        /// <param name="delete"></param>
        public RESTPermission(int query, int save, int delete)
        {
            Index = Read = query;
            Save = Update = SaveList = save;
            Delete = delete;
        }

    }
}
